import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class City here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class City extends World
{

    /**
     * Constructor for objects of class City.
     * 
     */
    protected Shooter player;
    public City()
    {    
        // Create a new world with 800x600 cells with a cell size of 1x1 pixels.
        super(800, 600, 1, false); 
        player = new Shooter();
        addObject(player, 100, 100);
    }
    
    public Shooter getShooter(){
        return player;
    }
    
    public void act()
    {
        int randomInt = Greenfoot.getRandomNumber(500);
        if (randomInt < 2)
        {
            addObject(new Enemy(), Greenfoot.getRandomNumber(getWidth()), -30);
        }
        else if (randomInt < 4)
        {
            addObject(new Enemy(), Greenfoot.getRandomNumber(getWidth()), getHeight()+30);
        }
        else if (randomInt < 6)
        {
            addObject(new Enemy(), -30, Greenfoot.getRandomNumber(getHeight()));
        }
        else if (randomInt < 8)
        {
            addObject(new Enemy(), getWidth() + 30, Greenfoot.getRandomNumber(getHeight()));
        }
    }
}
